package com.example.blog.entity;

import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import org.hibernate.validator.constraints.Length;

import javax.validation.constraints.NotBlank;
import java.io.Serializable;
import java.time.LocalDateTime;

/**
 * <p>
 * 
 * </p>
 *
 * @author 刘扬新
 * @since 2023-06-27
 */
public class Article implements Serializable {

    private static final long serialVersionUID = 1L;

    @TableId(value = "id", type = IdType.AUTO)
    private Integer id;

    /**
     * 作者
     */
    private String author;

    /**
     * 标题
     */
    @NotBlank(message = "文章标题不能为空！")
    @Length(min = 4,max = 100,message = "标题长度必须是4~100个字符 ")
    private String title;

    /**
     * 内容
     */
    @NotBlank(message = "文章内容不能为空！")
    @Length(min = 20,max = 5000,message = "标题内容必须是20-5000个字符")
    private String content;

    /**
     * 关键字
     */

    @TableField("keyWords")
    //不加注解,mybatis生成的字端名是key_words
    private String keyWords;

    /**
     * 描述
     */
    private String description;

    /**
     * 栏目
     */
    @TableField("categoryId")
    private Integer categoryId;

    /**
     * 标签，用逗号分隔
     */
    private String label;

    /**
     * 标题图片列表
     */
    @NotBlank(message = "封面图片不能为空！")
    @TableField("titleImgs")
    private String titleImgs;

    /**
     * 状态
     */
    private String status;

    /**
     * 发布时间
     */
    @TableField("createTime")
    private LocalDateTime createTime;

    /**
     * 阅读量
     */
    @TableField("readCnt")
    private Integer readCnt;

    /**
     * 点赞数
     */
    @TableField("agreeCnt")
    private Integer agreeCnt;


    public Integer getId() {
        return id;
    }

    public void setId(Integer id) {
        this.id = id;
    }

    public String getAuthor() {
        return author;
    }

    public void setAuthor(String author) {
        this.author = author;
    }

    public String getTitle() {
        return title;
    }

    public void setTitle(String title) {
        this.title = title;
    }

    public String getContent() {
        return content;
    }

    public void setContent(String content) {
        this.content = content;
    }

    public String getKeyWords() {
        return keyWords;
    }

    public void setKeyWords(String keyWords) {
        this.keyWords = keyWords;
    }

    public String getDescription() {
        return description;
    }

    public void setDescription(String description) {
        this.description = description;
    }

    public Integer getCategoryId() {
        return categoryId;
    }

    public void setCategoryId(Integer categoryId) {
        this.categoryId = categoryId;
    }

    public String getLabel() {
        return label;
    }

    public void setLabel(String label) {
        this.label = label;
    }

    public String getTitleImgs() {
        return titleImgs;
    }

    public void setTitleImgs(String titleImgs) {
        this.titleImgs = titleImgs;
    }

    public String getStatus() {
        return status;
    }

    public void setStatus(String status) {
        this.status = status;
    }

    public LocalDateTime getCreateTime() {
        return createTime;
    }

    public void setCreateTime(LocalDateTime createTime) {
        this.createTime = createTime;
    }

    public Integer getReadCnt() {
        return readCnt;
    }

    public void setReadCnt(Integer readCnt) {
        this.readCnt = readCnt;
    }

    public Integer getAgreeCnt() {
        return agreeCnt;
    }

    public void setAgreeCnt(Integer agreeCnt) {
        this.agreeCnt = agreeCnt;
    }

    @Override
    public String toString() {
        return "Article{" +
        "id=" + id +
        ", author=" + author +
        ", title=" + title +
        ", content=" + content +
        ", keyWords=" + keyWords +
        ", description=" + description +
        ", categoryId=" + categoryId +
        ", label=" + label +
        ", titleImgs=" + titleImgs +
        ", status=" + status +
        ", createTime=" + createTime +
        ", readCnt=" + readCnt +
        ", agreeCnt=" + agreeCnt +
        "}";
    }
}
